Carlos Garnacho [Mon, 29 Jan 2018 11:31:53 +0000 (12:31 +0100)]
gtkwindow: Unset focus grab_widget if it ends up unmapped
This may result on the later emission of crossing events, with one of the
sides being already unmapped/unrealized. The widget being unmapped will
result on repick and emission of a set of crossing events anyway.
Carlos Garnacho [Mon, 11 Dec 2017 18:21:38 +0000 (19:21 +0100)]
gtk: Add GtkEventControllerKey
This event controller is meant to replace usage from key-press/release-event
handlers all through. Optionally it can be set a GtkIMContext, so interaction
is carried by the controller.
Benjamin Otte [Thu, 5 Apr 2018 16:18:55 +0000 (18:18 +0200)]
snapshot: Don't cause invalid reads
1. Pass clip rectangles to gtk_snapshot_push_state() that point into
the state array.
2. g_array_set_size(len+1) the state array
3. Make that function realloc() the state array.
4. The clip rectangle now points into invalid memory
5. Use the clip array
This patch fixes things by moving step 5 to before step 2.
Benjamin Otte [Thu, 5 Apr 2018 15:32:57 +0000 (17:32 +0200)]
rendernode: Add missing return
Don't to extra work when not needed.
Piotr Drąg [Thu, 5 Apr 2018 15:37:22 +0000 (17:37 +0200)]
Update POTFILES.in
Benjamin Otte [Thu, 5 Apr 2018 15:09:52 +0000 (17:09 +0200)]
widget: Fix variable names
Stop docs build from complaining
Benjamin Otte [Thu, 5 Apr 2018 15:05:21 +0000 (17:05 +0200)]
a11y: Fix headers
We were getting a gcc warning before.
Benjamin Otte [Thu, 5 Apr 2018 14:36:13 +0000 (14:36 +0000)]
Merge branch 'window-activate' into 'master'
a11y: restore window:activate/deactivate emission
Closes #127
See merge request GNOME/gtk!77
Samuel Thibault [Fri, 23 Mar 2018 17:33:58 +0000 (18:33 +0100)]
a11y: restore window:activate/deactivate emission
1b9aa1b708c2 ('a11y: drop the focus tracker') removed a bit too much. We
still have to emit window:activate/deactivate events. They are easy to
emit anyway.
Fixes #127
Benjamin Otte [Thu, 5 Apr 2018 10:58:46 +0000 (12:58 +0200)]
inspector: Add an fps overlay
Benjamin Otte [Wed, 4 Apr 2018 11:22:28 +0000 (13:22 +0200)]
inspector: Bring back debug updates
This time, they are implemented as an overlay, so they require a running
inspector and can't be enabled via env variable anymore.
Benjamin Otte [Wed, 4 Apr 2018 11:14:21 +0000 (13:14 +0200)]
widget: Remove draw signal
The only remaining user is the text handle, but the text handle doesn't
draw anything anyway currently, so whoever fixes it can make it use
snapshots.
Benjamin Otte [Wed, 4 Apr 2018 10:38:09 +0000 (12:38 +0200)]
inspector: Introduce so-called "overlays"
Overlays are drawings that get rendered on top of the inspected window.
The only overlay in existence so far is the highlight overlay, which is
used to highlight widgets and replaces the "draw" signal handler used
previously.
Benjamin Otte [Wed, 4 Apr 2018 10:01:17 +0000 (12:01 +0200)]
widget: Add gtk_widget_compute_bounds()
The first in a set of functions intended to query widget coordinates
from another widget's coordinate system.
Benjamin Otte [Tue, 3 Apr 2018 19:09:35 +0000 (21:09 +0200)]
inspector: Change semantics of inspector render node notify
Instead of just notifying the inspector of what is going to be rendered,
allow the inspector to modify it.
This way, the inspector can overlay information it deems relevant over
the render node while still having access to what the actual widget
(without the inspector) would paint.
Benjamin Otte [Tue, 3 Apr 2018 12:14:37 +0000 (14:14 +0200)]
image: Actually report a request mode
This makes height-for-width actually work for GtkImage.
I'm kinda ashamed I didn't notice it not working before.
Benjamin Otte [Tue, 3 Apr 2018 07:30:55 +0000 (09:30 +0200)]
treeview: Remove invalidation tracking code
Benjamin Otte [Mon, 2 Apr 2018 07:18:48 +0000 (09:18 +0200)]
testgtk: Remove draw signal usage
Benjamin Otte [Mon, 2 Apr 2018 06:34:08 +0000 (08:34 +0200)]
widget: Remove GtkWidget.draw vfunc
Widgets are exclusively snapshot now.
The draw signal still exists.
Benjamin Otte [Mon, 2 Apr 2018 06:28:34 +0000 (08:28 +0200)]
widget: Remove gtk_widget_draw()
If you want to draw a widget to cairo today, you create a widget
paintable, snapshot it to a render node and then draw the render node to
cairo.
And yes, this is that complicated on purpose. Don't draw widgets to
Cairo.
Benjamin Otte [Mon, 2 Apr 2018 06:25:04 +0000 (08:25 +0200)]
reftests: Port from gtk_widget_draw() to snapshots
Benjamin Otte [Mon, 2 Apr 2018 06:19:51 +0000 (08:19 +0200)]
testgtk: Take an actual snapshot of a widget
Don't just draw the widget, take the paintable of it instead!
Benjamin Otte [Mon, 2 Apr 2018 06:12:37 +0000 (08:12 +0200)]
testlist3: Set the actual row as drag icon
(Well, don't do anything actually, because dnd is broken, but
in theory...)
Benjamin Otte [Mon, 2 Apr 2018 06:04:39 +0000 (08:04 +0200)]
widgetpaintable: Implement get_current_image()
Now that snapshot and empty paintables exist, this is rather trivial.
Benjamin Otte [Mon, 2 Apr 2018 05:55:02 +0000 (07:55 +0200)]
paintable: Introduce gdk_paintable_new_empty()
Also, use it where appropriate.
Benjamin Otte [Mon, 2 Apr 2018 04:15:50 +0000 (06:15 +0200)]
snapshot: Allow passing the bounds of the created paintable
This allows being more specific about the size.
It's useful in particular when the resulting render nodes might be
too small for the size, not only when they are too large. For the
latter case, using a clip node would be enough.
It also requires adding a clip node when rendering the resulting
paintable, but that should be optimized out by GtkSnapshot when not
necessary.
Benjamin Otte [Sun, 1 Apr 2018 13:25:16 +0000 (15:25 +0200)]
widgetpaintable: Protect against too many signals
This is actually not just a mechnaism to protect against too many
signals, but it's also a method to getting those signals at the wrong
time.
For every size/content change, a widget needs to invalidate twice:
Once when it queues a resize/redraw (going valid => invalid) and once
when the new size/content is actually assigned (going invalid => valid).
However, one of those invalidations might be inconvenient for the
listener. GtkImage for example does not like receiving
invalidate-contents signals when new contents are assigned, but is fine
with them when the old ones go invalid. And it will not try to draw the
paintable in between anyway.
So by bypassing the 2nd emission if nothing was changed, we can make
GtkImage happy.
Benjamin Otte [Sat, 31 Mar 2018 19:59:41 +0000 (21:59 +0200)]
demos: Add an image demo for widget paintables
Benjamin Otte [Sat, 31 Mar 2018 19:02:28 +0000 (21:02 +0200)]
widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
Benjamin Otte [Sat, 31 Mar 2018 18:15:47 +0000 (20:15 +0200)]
widget: Don't keep track of clip anymore.
It's not used anywhere, so why would we need it?
Benjamin Otte [Sat, 31 Mar 2018 18:02:55 +0000 (20:02 +0200)]
broadway: Improve error message
This error message is printed into the journal if a GTK app can't
connect to eithre Wayland or X11. Make it at least mention who is not
capable of connecting to a server.
Unrelated, we might want to improve our error reporting when a GTK app
can't start, so that debugging issues with system startup / login get
easier to resolve.
Benjamin Otte [Sat, 31 Mar 2018 16:37:53 +0000 (18:37 +0200)]
widget: Don't clip widgets anymore when snapshotting
This is the first step in removing clips.
It's seperate to allow bisecting to this commit when analyzing
performance problems.
Benjamin Otte [Sat, 31 Mar 2018 15:52:47 +0000 (17:52 +0200)]
widget: Cache clip from creating render node
When the clip changes that is passed to a snapshot function, we need to
create eventual cached render nodes because they might not have drawn
their whole area before.
Fixes issues with redrawing when scrolling.
Benjamin Otte [Sat, 31 Mar 2018 15:22:48 +0000 (17:22 +0200)]
snapshot: Track clip as a rect only
Benjamin Otte [Sat, 31 Mar 2018 10:52:19 +0000 (12:52 +0200)]
diff: Allow aborting a diff
When the max cost for finding a path gets to high, the diff can now be
aborted.
Because render nodes have a fallback method (by just marking the whole
bounds of the nodes as different), we use this to improve performance
of diffs.
This brings fishbowl (which is basically a container node with N images
that change every frame) back to close to previous performance.
Benjamin Otte [Sat, 31 Mar 2018 09:05:31 +0000 (11:05 +0200)]
build: Switch order of subdirectories
After fixing this once already in
5970dac1679d the order was messed up
again in
d50708b0240.
Benjamin Otte [Sat, 31 Mar 2018 09:02:32 +0000 (11:02 +0200)]
diff: Introduce GskDiffSettings
We can put lots of settings there to allow tuning the diff algorithm
used.
Benjamin Otte [Sat, 31 Mar 2018 06:17:42 +0000 (08:17 +0200)]
vulkan: Always render clip extents
Now that we have the full render nodes available, there is not much
benefit in fine-grained control over multiple rectangles.
In particular, it's causing pain with complex regions.
There might be a benefit in clipping to the region's rectangles in cases
like widget-factory where the whole diff is made up of the 2 rectangles
of spinner and the pulsing progress bar, but it needs a good heuristic
for where this is useful.
Benjamin Otte [Fri, 30 Mar 2018 13:39:25 +0000 (15:39 +0200)]
snapshot: Remove clip argument from gtk_snapshot_new()
It's not used anymore. And anybody who wants to have a clip on a
newly created snapshot can achieve that using gtk_snapshot_push_clip().
Benjamin Otte [Wed, 28 Mar 2018 15:09:49 +0000 (17:09 +0200)]
gtk: Remove gtk_widget_queue_draw_region()
... and gtk_widget_queue_draw_area().
They don't doi anything anymore.
Benjamin Otte [Wed, 28 Mar 2018 14:42:26 +0000 (16:42 +0200)]
widget: Stop tracking invalidations
Instead of calling gdk_surface_invalidate_region(), just
gdk_surface_queue_expose() and rely on the renderer computing the diff
from the previous rendering.
Benjamin Otte [Wed, 28 Mar 2018 14:06:32 +0000 (16:06 +0200)]
gtk: Remove debug updates
With the soon-to-arrive automatic updates (aka computing invalid region
from render nodes), this will no longer be necessary.
Benjamin Otte [Wed, 28 Mar 2018 13:43:43 +0000 (15:43 +0200)]
renderer: Track the previous node
... and diff the previous node with the current one to determine the
clip region.
This doubles the work necessary to track clip regions, but the following
commits will clean that up.
Benjamin Otte [Wed, 28 Mar 2018 13:01:34 +0000 (15:01 +0200)]
gsk: move begin/end_frame vfuncs into the renderers
Benjamin Otte [Tue, 27 Mar 2018 23:29:39 +0000 (01:29 +0200)]
gsk: Fold gsk_renderer_begin_draw_frame() into renderer
It doesn't need to be exported anymore.
As a side effect, the inspector no longer has any information about the
render region, so remove the code that was taking care of that.
Benjamin Otte [Tue, 27 Mar 2018 23:00:07 +0000 (01:00 +0200)]
widget: Reorder gtk_widget_render()
Now that we don't clip the created render nodes anymore, we don't have
to compute the clip region beforehand.
So snapshot the render nodes before initializing the renderer.
Benjamin Otte [Tue, 27 Mar 2018 22:34:23 +0000 (00:34 +0200)]
gsk: Implement gsk_render_node_diff()
This includes a copy of the diff(1) algorithm used by git diff by Davide
Libenzi.
It's used for the common case ofcontainer nodes having only very few
changes for the few nodes of child widgets that changed (like a button
lighting up when hilighted or a spinning spinner).
Benjamin Otte [Fri, 23 Mar 2018 04:01:11 +0000 (05:01 +0100)]
magnifier: Redo with GtkWidgetPaintable
Benjamin Otte [Thu, 22 Mar 2018 19:47:28 +0000 (20:47 +0100)]
gtk: Add GtkWidgetPaintable
A GtkWidgetPaintable is a paintable that observes a given GtkWidget and
renders that widget into a paintable.
Benjamin Otte [Tue, 20 Mar 2018 17:55:33 +0000 (18:55 +0100)]
widget: Cache the render node
This requires a bunch of refactorings:
1. Don't pass the current clip region to gtk_widget_snapshot()
so we don't create full widget contents
3. Have a widget->priv->draw_needed that we invalidate on every
queue_draw() call and set on every snapshot()
2. In queue_draw(), walk the widget chain to invalidate the
render nodes of all parents
Benjamin Otte [Tue, 20 Mar 2018 00:37:05 +0000 (01:37 +0100)]
rendernode: Add gsk_render_node_diff()
... and gsk_render_node_can_diff(). Those are vfuncs to compute a region
containing all the pixels that differ between the two nodes.
This is just the plumbing that chains into node classes. No node
implements it yet.
Matthias Clasen [Thu, 5 Apr 2018 10:22:43 +0000 (06:22 -0400)]
font button: fix compiler warnings
A PangoLanguage is not a string.
Benjamin Otte [Wed, 4 Apr 2018 18:19:08 +0000 (18:19 +0000)]
Merge branch 'text-changed-delete-4' into 'master'
gtkentryaccessible: Fix text-changed::delete length
See merge request GNOME/gtk!100
Benjamin Otte [Wed, 4 Apr 2018 18:18:49 +0000 (18:18 +0000)]
Merge branch 'textview-delete-4' into 'master'
gtktextviewaccessible: update cursor position after text suppression
See merge request GNOME/gtk!102
Samuel Thibault [Wed, 4 Apr 2018 16:18:29 +0000 (18:18 +0200)]
gtktextviewaccessible: update cursor position after text suppression
delete_range_cb is set to be called before the text suppression done by
the gtktextlayout (otherwise it does not work properly). But at that
point the cursor position is not yet up to date. We thus need to move
the accessibility cursor notification to after the actual text
suppression, by using another callback.
This fixes cursor position in brltty screen reading.
(cherry picked from commit
fa6994d0331a219e85dce01007b2d6f3f7fd43c9)
Samuel Thibault [Wed, 4 Apr 2018 15:56:38 +0000 (17:56 +0200)]
gtkentryaccessible: Fix text-changed::delete length
The second parameter of the text-changed::delete event is to be the length,
not the end position. This fixes spurious text removals in brltty
screen reading.
(cherry picked from commit
209f908a03a9d27508704425a57dcd533fab4c7d)
Daniel Boles [Wed, 4 Apr 2018 11:00:52 +0000 (12:00 +0100)]
GLArea: Remove wrong transfer annotation on new()
Like other widgets, this returns a floating reference, so
(transfer full) is wrong. Just omit the annotation as others do,
thus implying (transfer none).
Close https://gitlab.gnome.org/GNOME/gtk/issues/156
Lionel Landwerlin [Tue, 27 Mar 2018 18:42:43 +0000 (19:42 +0100)]
imwayland: destroy objects only if it matches our manager object
Should fix one of the crash from #129.
Matthias Clasen [Mon, 2 Apr 2018 21:46:41 +0000 (17:46 -0400)]
font chooser: Remove some dead code
This is leftover code from already removed debug spew.
Matthias Clasen [Mon, 2 Apr 2018 21:45:48 +0000 (17:45 -0400)]
font button: Fix a crash
Since we are now storing the language as a PangoLanguage,
we must not free it anymore.
Matthias Clasen [Mon, 2 Apr 2018 17:34:22 +0000 (13:34 -0400)]
font chooser: Make the language property writable
This is meant as an input to the font chooser.
We don't want the user to select a language, but
rather have fonts presented as they would work for
the current language. Therefore, do away with the
lang/script combo on the tweak page.
Chun-wei Fan [Wed, 28 Mar 2018 04:57:28 +0000 (12:57 +0800)]
gtk, demos: Fix builds without HarfBuzz and PangoFT
Really exclude the portions in the gtkfontchooserwidget.c that are built
when HarfBuzz and PangoFT2 are built, and update the Meson files to
exclude such sources as well from the main GTK SO/DLL and from the
gtk4-demo program.
https://bugzilla.gnome.org/show_bug.cgi?id=773299
Chun-wei Fan [Wed, 28 Mar 2018 04:17:39 +0000 (12:17 +0800)]
testsuite/gsk/test-render-nodes.c: Avoid VLA usage
Just #define N as 5, instead of using a const int, which is not enough
to justify that as non-VLA usage.
https://bugzilla.gnome.org/show_bug.cgi?id=773299
Chun-wei Fan [Wed, 28 Mar 2018 03:59:11 +0000 (11:59 +0800)]
[gtk|demos/gtk-demo]/language-names.c: Fix build on non-GCC/CLang
Remove g_auto*() usage from these sources and use the traditional
g_free(), as g_auto*() are GCCisms (or CLangisms).
Also, don't include unistd.h unconditionally and stop including
langinfo.h and dirent.h, since they seem to be unused.
https://bugzilla.gnome.org/show_bug.cgi?id=773299
Chun-wei Fan [Wed, 28 Mar 2018 04:13:08 +0000 (12:13 +0800)]
build: Fix linking demos on Visual Studio
The demos are now built as GUI programs, which will require the presence
of WinMain() on Visual Studio builds, unless we specify the entry point.
Pass the /entry:mainCRTStartup linker flag on Visual Studio builds for
the demo programs so that they can link properly.
https://bugzilla.gnome.org/show_bug.cgi?id=773299
Matthias Clasen [Sun, 1 Apr 2018 23:35:55 +0000 (19:35 -0400)]
font chooser: Add examples for font features
For some font features, we can figure out affected
glyphs, and show before/after. For some others, we
hardcode typical sequences.
Still to do: figure out how to find ligatures and
show them.
Matthias Clasen [Sun, 1 Apr 2018 23:34:27 +0000 (19:34 -0400)]
widget-factory: Enable all details in the font chooser
We want to see this here.
Piotr Drąg [Sun, 1 Apr 2018 13:00:07 +0000 (15:00 +0200)]
Update POTFILES.in
Руслан Ижбулатов [Sun, 4 Mar 2018 02:48:10 +0000 (02:48 +0000)]
W32: Link GTK to pangowin32
Needed for pango_win32_font_logfont() from gtkimcontextime.
https://bugzilla.gnome.org/show_bug.cgi?id=773299
LRN [Sun, 1 Apr 2018 10:33:43 +0000 (10:33 +0000)]
Merge branch 'lrn/issue-147' into 'master'
Fix cursor handling in GTK4 on W32
Closes #147
See merge request GNOME/gtk!92
Rico Tzschichholz [Sun, 1 Apr 2018 07:15:08 +0000 (09:15 +0200)]
Fix some g-i annotation warnings
Matthias Clasen [Sun, 1 Apr 2018 01:31:11 +0000 (21:31 -0400)]
Enable variations and features for font explorer
Matthias Clasen [Sun, 1 Apr 2018 01:01:47 +0000 (21:01 -0400)]
font chooser: Align level value names
In the backport, I used the plural for variations, and that
is a better name, so use it here too.
Matthias Clasen [Sun, 1 Apr 2018 00:59:35 +0000 (20:59 -0400)]
font chooser: Align property defaults
Set the default font chooser level to the same value we use
in the backports, to preserve font chooser behavior.
Matthias Clasen [Sat, 31 Mar 2018 22:57:06 +0000 (18:57 -0400)]
Font chooser: Hide tweak button sometimes
When there is no chance of tweaking anything, don't
show a tweak button.
Matthias Clasen [Sat, 31 Mar 2018 22:49:15 +0000 (18:49 -0400)]
Defeat compiler optimization
We always want to call both update functions here, and
the compiler unhelpfully optimizes out the second call
if the first one returns TRUE.
Timm Bäder [Sat, 31 Mar 2018 11:52:19 +0000 (13:52 +0200)]
GskRenderer: Remove outdated documentation comment
All render node trees are immutable
Timm Bäder [Sat, 31 Mar 2018 09:41:13 +0000 (11:41 +0200)]
snapshot: Plug memory leak when collecting rounded clip nodes
Timm Bäder [Fri, 30 Mar 2018 21:32:19 +0000 (23:32 +0200)]
gl renderer: Don't highlight cairo nodes as fallback
Daniel Boles [Sat, 31 Mar 2018 11:27:21 +0000 (12:27 +0100)]
ProgressBar: Drop leftover "superimposed" mention
This was missed from the commit that dropped other mentions to the
previous ability to superimpose text.
https://bugzilla.gnome.org/show_bug.cgi?id=748784
Nelson Benítez León [Wed, 15 Nov 2017 14:46:31 +0000 (19:46 +0500)]
appchooserwidget: search text using g_str_match_string()
so we match on diacritics (eg. accented letters) and also
search on text tokens. As a plus we also reduce code size.
https://bugzilla.gnome.org/show_bug.cgi?id=745128
Timm Bäder [Thu, 29 Mar 2018 18:20:35 +0000 (20:20 +0200)]
togglebutton: Remove priv pointer
Timm Bäder [Thu, 29 Mar 2018 18:15:39 +0000 (20:15 +0200)]
popover: Remove priv pointer
Timm Bäder [Thu, 29 Mar 2018 16:16:58 +0000 (18:16 +0200)]
shaderbuilder: Insert newlines directly after defines
Instead of doing that in the loop in the last interation, we can just do
it after the loop.
Timm Bäder [Thu, 29 Mar 2018 14:37:20 +0000 (16:37 +0200)]
gl renderer: Remover unused mask uniform
Timm Bäder [Thu, 29 Mar 2018 14:15:40 +0000 (16:15 +0200)]
shader builder: Remove unused members
Timm Bäder [Thu, 29 Mar 2018 14:14:18 +0000 (16:14 +0200)]
shader builder: Reuse GString for shader code
Timm Bäder [Thu, 29 Mar 2018 07:00:48 +0000 (09:00 +0200)]
widget: Fix snapshot condition
Of course, we only need to snapshot if both width and height > 0,
otherwise the result is invisible.
Timm Bäder [Thu, 29 Mar 2018 06:40:46 +0000 (08:40 +0200)]
entrybuffer: Remove priv pointer
Timm Bäder [Thu, 29 Mar 2018 06:32:51 +0000 (08:32 +0200)]
menubar: Don't crash when cycling through menubars
Matthias Clasen [Fri, 30 Mar 2018 20:14:40 +0000 (20:14 +0000)]
Merge branch 'im-wayland-reset' into 'master'
wayland: Don't emit signals if nothing changed
See merge request GNOME/gtk!83
Benjamin Otte [Fri, 30 Mar 2018 16:25:48 +0000 (18:25 +0200)]
fishbowl: Make stats tracking work somewhat with broken X servers
Broken X servers being the ones that don't support NET_WM_TIMINGS (ie
every WM but mutter and XWayland).
Benjamin Otte [Fri, 30 Mar 2018 14:47:52 +0000 (16:47 +0200)]
demos: Improve frame rate tracking for fishbowl demo
We now properly use GdkFrameTimings and can therefor check for dropping
even a single frame in the history (of 16 frames or 1/4 of a second).
Once that happens, we immediately stop adding new items to the bowl.
A side effect is that the number of icons is now a *lot* smaller.
Benjamin Otte [Fri, 30 Mar 2018 13:36:54 +0000 (15:36 +0200)]
x11: Always request frame updates
This ensures that the frame clock gets updated with correct presentation
times even if nothing was drawn.
This is necessary for benchmarking but would also be relevant for videos
that want to sync to the frame clock but draw frames a lot less.
Benjamin Otte [Fri, 30 Mar 2018 08:43:26 +0000 (10:43 +0200)]
x11: Make the frame clock work in GL and Vulkan
Руслан Ижбулатов [Thu, 29 Mar 2018 23:42:49 +0000 (23:42 +0000)]
GDK W32: Remember surface cursor, implicit surface grab
This commit ensures that each GdkSurface impl remembers the
cursor that GDK sets for it, and that this cursor is set
each time WM_SETCURSOR is called for that sufrace's HWND.
This is needed because W32, unlike X, has no per-window cursors -
the cursor on W32 is a global resource, and we need to keep track
of which cursor should be set when pointer is over which surface
ourselves (WM_SETCURSOR exists exactly for this reason).
This commit also makes GDK remember the surface that has an implicit
grab (since implicit grabs are gone from the upper levels of the toolkit),
and ensures that crossing events are correctly synthesized and the grab
is broken when surface focus changes. This fixes a bug where opening
a new window (by clicking something in some other, pre-existing window)
will make that new window not get any mouse input due to the fact
that the mouse-button-down event from that click caused an implicit
grab on the pre-existing window, and that grab was not released afterward.
Руслан Ижбулатов [Thu, 29 Mar 2018 23:40:32 +0000 (23:40 +0000)]
GDK W32: Use the new cursor class
This makes all the code use the new cursor class instead of
raw HCURSOR handles.
Руслан Ижбулатов [Thu, 29 Mar 2018 23:38:05 +0000 (23:38 +0000)]
GDK W32: New cursor class
Instead of now-unused GdkWin32Cursor class (a subclass of GdkCursor),
add a stand-alone GdkWin32HCursor class that is a wrapper around
HCURSOR handle.
On creation it's given a display instance, a HCURSOR handle and a boolean
that indicates whether the HCURSOR handle can or cannot be destroyed
(this depends on how the handle was obtained).
That information is stored in a hash table inside the GdkWin32Display
singleton, each entry of that table has reference count.
When the GdkWin32HCursor object is finalized, it reduces the reference
count on the table entry in the GdkWin32Display. When it's created,
it either adds such an entry or refs an existing one.
This way two pieces of code (or the same piece of code called
multiple times) that independently obtain the same HCURSOR from the OS
will get to different GdkWin32HCursor instances, but GdkWin32Display
will know that both use the same handle.
Once the reference count reaches 0 on the table entry, it is freed
and the handle (if destroyable) is put on the destruction list,
and an idle destruction function is queued.
If the same handle is once again registered for use before the
idle destructior is invoked (this happens, for example, when
an old cursor is destroyed and then replaced with a new one),
the handle gets removed from the destruction list.
The destructor just calls DestroyCursor() on each handle, calling
SetCursor(NULL) before doing that when the handle is in use.
This ensures that SetCursor(NULL) (which will cause cursor to disappear,
which is bad by itself, and which will also cause flickering if the
cursor is set to a non-NULL again shortly afterward)
is almost never called, unless GTK messes up and keeps using a cursor
beyond its lifetime.
This scheme also ensures that non-destructable cursors are not destroyed.
It's also possible to call _gdk_win32_display_hcursor_ref()
and _gdk_win32_display_hcursor_unref() manually instead of creating
GdkWin32HCursor objects, but that is not recommended.
Daniel Boles [Thu, 29 Mar 2018 20:23:50 +0000 (21:23 +0100)]
themes: Make disabled Expander arrow look disabled
If GtkExpander:sensitive was FALSE, the arrow still got the normal fg
colour, which made it look clickable, in contrast to the adjacent label.
Fix this by adding selectors to catch the applicable :disabled states.
Note: Needing these may indicate an oops in generic styles elsewhere,
but I couldn’t see any, so let’s just get it looking right for now.
Close https://gitlab.gnome.org/GNOME/gtk/issues/146
Daniel Boles [Thu, 29 Mar 2018 18:36:40 +0000 (19:36 +0100)]
emojichooser.ui: Add i18n context to all tooltips…
…since, unlike in gtk-3-22, it's not just Objects that already had that
here in the title labels. Thanks to Piotr for spotting this!